<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            let script = document.createElement('script')
            script.type = 'text/javascript'
            // 传参一个回调函数名给后端，方便后端返回时执行这个在前端定义的回调函数
            script.src = 'http://localhost:8080/login?user=admin&callback=handleCallback'
            document.head.appendChild(script)
            // 回调执行函数
            function handleCallback(res) {
                alert(JSON.stringify(res))
            }
        </script>
    </body>
</html>
